home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / SCREEN.SWG / 0014_TESTVID.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  4KB  |  100 lines

  1. Program TestVid;
  2.  
  3. { High speed Text-video routines For working With binary Files, direct   }
  4. { screen access etc.  (c)1993 Chris Lautenbach                           }
  5. {                                                                        }
  6. { You are hereby permitted to use this routines, so long as you give me  }
  7. { credit.  If you modify them, do not distribute the modified version.   }
  8. {                                                                        }
  9. { This is the example Program, see SPEEDVID.PAS For the actual Unit      }
  10. { code, and usage information.                                           }
  11. {                                                                        }
  12. { "ScreenFile" is a File containing sequential binary screen images. The }
  13. { easiest way to make these, is to draw several screens in a Program     }
  14. { like TheDraw, then save them as Binary.  After you are done, copy them }
  15. { all to one File, like so:                                              }
  16. {                                                                        }
  17. { COPY /B SCREEN1.BIN+SCREEN2.BIN+SCREEN3.BIN SCREEN.BIN                 }
  18. {                                                                        }
  19. { Note: the /B option is NECESSARY.  Without specifying binary mode,     }
  20. {       COPY will insert ^Z's and other wierd stuff that will screw up   }
  21. {       the resulting File.                                              }
  22.  
  23. Uses  Dos, Crt, SpeedVid;
  24.  
  25. Var   ScreenFile : File of ScreenLine;
  26.       StartLine, TempLine, idx : Integer;
  27.       Cmd : Char;
  28.       p : Pointer;
  29.  
  30. Procedure ShowScreenLine(Index:Word);
  31. begin
  32.   If StartLine+Index<Filesize(ScreenFile) then
  33.   begin
  34.     Seek(ScreenFile, StartLine+Index-1);
  35.     Read(ScreenFile, VideoScreen[Index]);
  36.   end;
  37. end;
  38.  
  39. begin
  40.   MonoMode := (VideoMode = 7);
  41.   SaveScreen(P);
  42.   Assign(ScreenFile,'testvid.exe');
  43.   {$I-} Reset(ScreenFile); {$I+}
  44.   If IOResult<>0 then
  45.   begin
  46.     Writeln('Error: Cannot open SCREEN.BIN.');
  47.     Halt;
  48.   end;
  49.   StartLine:=0;
  50.   For TempLine:=1 to ScreenHeight do ShowScreenLine(TempLine);
  51.   Repeat
  52.     Repeat Until KeyPressed;
  53.     Cmd:=ReadKey;
  54.     If Cmd=#0 then
  55.     begin
  56.       Cmd:=ReadKey;
  57.       Case Cmd of
  58. {Down}  #80 : If StartLine+1<Filesize(ScreenFile) then
  59.               begin
  60.                 Inc(StartLine);
  61.                 ScrollScreen(Up);
  62.                 ShowScreenLine(ScreenHeight);
  63.               end;
  64. {Up}    #72 : If StartLine-1>=0 then
  65.               begin
  66.                 Dec(StartLine);
  67.                 ScrollScreen(Down);
  68.                 ShowScreenLine(1);
  69.               end;
  70. {PgDn}  #81 : begin
  71.                 If StartLine+ScreenHeight<Filesize(ScreenFile) then
  72.                   TempLine:=ScreenHeight
  73.                     ELSE
  74.                   TempLine:=ScreenHeight-(Filesize(ScreenFile)-ScreenHeight);
  75.                 For idx:=1 to TempLine do
  76.                 begin
  77.                   Inc(StartLine);
  78.                   ScrollScreen(Up);
  79.                   ShowScreenLine(ScreenHeight);
  80.                 end;
  81.               end;
  82. {PgUp}  #73 : begin
  83.                 If StartLine-ScreenHeight>=0 then
  84.                   TempLine:=ScreenHeight
  85.                     ELSE
  86.                   TempLine:=StartLine;
  87.                 For idx:=1 to TempLine do
  88.                 begin
  89.                   Dec(StartLine);
  90.                   ScrollScreen(Down);
  91.                   ShowScreenLine(1);
  92.                 end;
  93.               end;
  94.       end; {case}
  95.     end;
  96.   Until Cmd=#27; {ESC}
  97.   Close(ScreenFile);
  98.   RestoreScreen(P);
  99. end.
  100.